import { createRouter, createWebHistory } from 'vue-router';
import LoginVue from '@/views/Login.vue';
import LayoutVue from '@/views/Layout.vue';

import RuleOut from '@/views/title/RuleOut.vue';
import StudentScore1 from '@/views/title/StudentScore1.vue';
import StudentScore2 from '@/views/title/StudentScore2.vue';
import StudentScore3 from '@/views/title/StudentScore3.vue';
import Student from '@/views/title/Student.vue';
import UserInfo from '@/views/user/UserInfo.vue';
import UserAvatar from '@/views/user/UserAvatar.vue'; 
import UserResetPassword from '@/views/user/UserResetPassword.vue';

const routes = [
  // 移除重复的 component 属性
  { path: '/login', component: LoginVue },
  { 
    path: '/', 
    component: LayoutVue,
    redirect: '/title/ruleOut',
    children: [
      { path: '/title/ruleOut', component: RuleOut },
      { path: '/title/studentScore1', component: StudentScore1 },
      { path: '/title/studentScore2', component: StudentScore2 },
      { path: '/title/studentScore3', component: StudentScore3 },
      { path: '/title/student', component: Student },
      { path: '/user/info', component: UserInfo },
      { path: '/user/avatar', component: UserAvatar },
      { path: '/user/resetPassword', component: UserResetPassword }
    ]
  }
];

const router = createRouter({
  history: createWebHistory(),
  routes:routes,
});

export default router;